﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BrickAndBrick
{
    class Program
    {
        static void Main(string[] args)
        {
            //WindowController.SetWindowSize();
             // FindAvailible();
            FindAWay();
            //MouseSimulator.MoveBrick(8, 18);
            Console.ReadKey();
        }


        static void FindAWay()
        {
            BBMap map = BBPicAnalyse.GetBrickMap();
            if (map.GetTotalNums() % 2 == 1)
            {
                Console.WriteLine("fail!!!" + map.GetTotalNums());
                return;
            }
            List<BBStep> stepList = BBController.BeginScan(map);
            //return;
            if (stepList != null)
            {
                foreach (var step in stepList)
                {
                    BBAutoOperation.MoveBrick(step);
                    Thread.Sleep(150);
                }
            }
        }
        static void FindAvailible()
        {
            BBMap map = BBPicAnalyse.GetBrickMap();
            Console.WriteLine(map.ToString());
            List<BBStep> stepList = BBController.ScanAllAvailable(map);
            foreach (var item in stepList)
            {
                Console.WriteLine(item.movePos);
                Console.WriteLine(item.ToString());
            }
        }

    }
}
